package com.smart.common.util;

public class PageRequest implements Pageable {
	// 默认每页数据条数
	protected static final Integer DEFAULT_PAGE_SIZE = 20;
	// 默认当前页码
	protected static final Integer DEFAULT_PAGE_NUMBER = 1;

	// 每页显示数据条数
	private Integer rows = new Integer(DEFAULT_PAGE_SIZE);
	private Integer page = new Integer(DEFAULT_PAGE_NUMBER);

	public PageRequest() {
	}

	public PageRequest(Integer page, Integer rows) {
		setPage(page);
		setRows(rows);
	}

	public PageRequest(Integer page) {
		setPage(page);
	}

	@Override
	public int getRows() {
		return rows;
	}

	@Override
	public void setRows(int rows) {
		this.rows = rows;
	}

	@Override
	public int getPage() {
		return page;
	}

	@Override
	public void setPage(int curPage) {
		this.page = (curPage <= 0) ? DEFAULT_PAGE_NUMBER : curPage;
	}
}